package com.infore.siteManagement.OutSide.Controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.infore.siteManagement.OutSide.Service.IOutsideService;
import com.infore.siteManagement.util.ResultEntity;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * @author liulefa
 *暴露服务控制层
 *
 */
@Api(value = "被调用管理服务接口", tags = {"被调用管理服务接口"})
@RestController
@RequestMapping("/outSide")
public class OutSideController {

	@Autowired
	private IOutsideService iOutsideService;
	
	/**
	 * 传入协议id返回站点信息
	 * @param protocolDataId
	 * @return
	 */
	@ApiOperation(value = "根据协议返回站点")
	@ResponseBody
	@GetMapping(value = "/stations")
	public ResultEntity stationInfo(@RequestParam(value = "protocolDataId") String protocolDataId) {
		return iOutsideService.stationInfo(protocolDataId);
	}
	
	/**
	 * 传入指令id返回设备信息
	 * @param instructionsId
	 * @return
	 */
	@ApiOperation(value = "根据指令返回设备")
	@GetMapping(value = "/equipments")
	public ResultEntity equipmentInfo(@RequestParam(value = "instructionsId") String instructionsId) {
		return iOutsideService.equipmentInfo(instructionsId);
	}
	/**
	 * 传入站点mn集合 得到封装后的站点信息
	 * @param stationMnList
	 * @return
	 */
	@ApiOperation(value = "审核服务得到站点信息")
	@ResponseBody
	@RequestMapping(value = "/stationInfoAudit")
	public ResultEntity stationInfoAudit(@RequestParam(value = "stationMnList",required = false) List<String> stationMnList) {
		return iOutsideService.stationInfoAudit(stationMnList);
	}
	
	@ApiOperation(value = "审核服务得到监测因子信息")
    @ResponseBody
    @RequestMapping(value = "/projectInfoAllAudit")
    public ResultEntity projectInfoAllAudit() {
        return iOutsideService.projectInfoAllAudit();
    }
	
	@ApiOperation(value = "通过因子编码取得因子信息")
    @ResponseBody
    @PostMapping(value = "/proiectInfoAlarm")
    public ResultEntity proiectInfoAlarm() {
        return iOutsideService.proiectInfoAlarm();
    }
	
	@ApiOperation(value = "根据筛选条件得到站点编码----水质范围评价")
    @ResponseBody
    @GetMapping(value = "/queryStationMnByInfo")
    public ResultEntity queryStationMnByInfo(@RequestParam(value = "provinceId",required = false) String provinceId,
    		@RequestParam(value = "basinnId",required = false) String basinnId,
    		@RequestParam(value = "stationClassifyId",required = false) String stationClassifyId,
    		@RequestParam(value = "stationTypeId",required = false) String stationTypeId,
    		@RequestParam(value = "operCompanyId",required = false) String operCompanyId,
    		@RequestParam(value = "stationName",required = false) String stationName,
    		@RequestParam(value = "userId",required = false) String userId,
    		@RequestParam(value = "platfrom",required = false) String platfrom,
    		@RequestParam(value = "appCode",required = false) String appCode,
    		@RequestParam(value = "admin",required = false) String admin) {
        return iOutsideService.queryStationMnByInfo(provinceId,basinnId,stationClassifyId,
        		stationTypeId,operCompanyId,stationName,userId,platfrom,appCode,admin);
    }
	
	@ApiOperation(value = "查询仪器检测项目、分析方法、量程、厂商、型号信息")
    @ResponseBody
    @GetMapping(value = "/queryEquipments")
    public ResultEntity queryEquipments(@RequestParam(value = "stationMn",required = true) String stationMn) {
        return iOutsideService.queryEquipments(stationMn);
    }
	
	@ApiOperation(value = "新---查询仪器检测项目、分析方法、量程、厂商、型号信息------用来替换旧的外部接口")
    @ResponseBody
    @GetMapping(value = "/queryEquipNew")
    public ResultEntity queryEquipNew(@RequestParam(value = "stationMn",required = true) String stationMn)throws Exception {
        return iOutsideService.queryEquipNew(stationMn);
    }
}

